{extend name="public/base" /}

{block name="content-header"}
<!-- Content Header (Page header) -->
<div class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-6">
				<h1 class="m-0 text-dark">插件列表</h1>
			</div><!-- /.col -->
			<div class="col-sm-6">
				<ol class="breadcrumb float-sm-right">
					<li class="breadcrumb-item"><a href="{:Url('index/index')}">首页</a></li>
					<li class="breadcrumb-item active">插件列表</li>
				</ol>
			</div><!-- /.col -->
		</div><!-- /.row -->
	</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
{/block}

{block name="content-content"}
<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<div class="row">
			<div class="col-lg-12">
				<div class="card">
					<div class="card-header border-transparent">
						<div class="pull-left">
							<a href="javascript:location.reload();"><button type="button" class="btn btn-sm btn-info"><i class="fa fa-refresh"></i></button></a>
							<a href="javascript:history.go(-1);"><button type="button" class="btn btn-sm btn-info"><i class="fa fa-reply"></i></button></a>
							<a href="{:Url('create')}"><button type="button" class="btn btn-sm btn-success"><i class="fa fa-plus"></i>快速创建</button></a>
						</div>
					</div>
					<div class="card-body p-0">
						<div class="table-responsive">
							<table class="table m-0">
								<thead>
									<tr>
										<th>名称</th>
										<th>标识</th>
										<th >描述</th>
										<th width="43px">状态</th>
										<th>作者</th>
										<th width="43px">版本</th>
										<th width="94px">操作</th>
									</tr>
								</thead>
								<tbody>
									{notempty name="_list"}
									{volist name="_list" id="vo"}
									<tr>
										<td>{$vo.title}</td>
										<td>{$vo.name}</td>
										<td>{$vo.description}</td>
										<td>{$vo.status_text|default="未安装"}</td>
										<td><a target="_blank" href="{$vo.url|default='http://www.onethink.cn'}">{$vo.author}</a></td>
										<td>{$vo.version}</td>
										<td>
											{empty name="vo.uninstall"}
											<?php
				  $class	= get_addon_class($vo['name']);
				  if(!class_exists($class)){
				  $has_config = 0;
				  }else{
				  $addon = new $class();
				  $has_config = count($addon->getConfig());
				  }
				  ?>
				  {if $has_config}
				  <a href="{:Url('config',array('id'=>$vo['id']))}">设置</a>
				  {/if}
				  {if $vo['status'] >= 0}
				  {eq name="vo.status" value="0"}
				  <a class="ajax-get" href="{:Url('enable',array('id'=>$vo['id']))}">启用</a>
				  {else /}
				  <a class="ajax-get" href="{:Url('disable',array('id'=>$vo['id']))}">禁用</a>
				  {/eq}
				  {/if}
				  {// {eq name="vo.author" value="thinkphp"}}
				  <a class="ajax-get" href="{:Url('uninstall?id='.$vo['id'])}">卸载</a>
				  {// {/eq}}
				  {else /}
				  <a class="ajax-get" href="{:Url('install?addon_name='.$vo['name'])}">安装</a>
				  {/empty}
										</td>
									</tr>
									{/volist}
									{else/}
									<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
									{/notempty}
								</tbody>
							</table>
						</div>
						<!-- /.table-responsive -->
					</div>
					<!-- /.card-body -->
					{notempty name="_page"}
					<div class="card-footer clearfix">
						<div class="page">
							{$_page|raw}
						</div>
					</div>
					<!-- /.card-footer -->
					{/notempty}
				</div>
			</div>
		</div>
	</div><!-- /.container-fluid -->
</section>
<!-- /.content -->

<!-- Main content -->
<!-- /.content -->
{/block}

{block name='script'}
<script src="__THEME__/default/view/admin/static/js/common.js?v={:time_version()}"></script>
<script type="text/javascript" charset="utf-8">
//导航高亮
highlight_subnav('{:Url('index')}');
</script>
{/block}
